@extends('backstage.layout.master')
@section('title', '尺码列表')
@section('content')
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="backstage/home">主页</a>
            </li>

            <li class="active">
                <a href="backstage/size/size-list">尺码</a>
            </li>
            <li>
                尺码列表
            </li>
        </ul><!-- .breadcrumb -->
    </div>

    <div class="page-content">
        <div class="page-header">
            <h1>
                尺码
                <small>
                    <i class="icon-double-angle-right"></i>
                    尺码列表
                </small>
                <span class="pull-right">
                    <button class="btn btn-primary" onclick="javascript:window.location.href='{{asset('')}}backstage/product-temp/add-size';">添加尺码</button>
                </span>
            </h1>
        </div>
        <div class="row">
            <div class="nav-search col-xs-12" style="position: static;height: 50px;" id="nav-search">

                <select id="column4"  style="width:113px;">
                    <option value ="platform">产品模板分类</option>
                </select>
                <span class="input-icon">
					<select id="temp_category"  style="width:209px;">
                        @foreach($temp_categorys as $temp_category)
						<option value ={{isset($temp_category->category_id)?$temp_category->category_id:0}}>
                            {{isset($temp_category->name)?$temp_category->name:''}}
                        </option>
                        @endforeach
					</select>
				</span>
            </div>
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="table-responsive">
                    <table id="sample-table-1" class="table table-striped table-bordered table-hover" style="width: 120px" >
                        <thead>
                        <tr>
                            <th>尺码名</th>
                        </tr>
                        </thead>

                        <tbody id="temp_size">
                        @foreach ($sizes as $size)
                        <tr><td>{{$size}}</td></tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
                <!-- PAGE CONTENT ENDS -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
@stop
@section('script')
    <script type="text/javascript">
        $(function () {
            $('#temp_category').change(function() {
                var class_id=$(this).val();
                $.ajax({
                    type: "POST",
                    url: "/backstage/product-temp/size-list",
                    data: {'class_id':class_id},
                    success: function (msg) {
                        if(msg.state=1){
                            var html='';
                            for(var a=0;a<msg['data'].length;a++) {
                                html+='<tr><td>'+ msg['data'][a] +'</td></tr>';
                            }
                            $("#temp_size").html(html);
                        }
                    }, error: function () {
                        swal({title: "系统繁忙！", text: "",type: "error", timer:1000 })
                    }
                });
            });
        });
    </script>
@stop